import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

import http from '@/http.js'//axios相关配置
import '@/assets' //样式资源

import MintUI, { Search } from 'mint-ui'
//import 'mint-ui/lib/style.css'
Vue.use(MintUI)

//引入lazyload
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload,{
  preLoad:1.3,
  error: require('@/assets/img/error.png'),
  loading: require('@/assets/img/loading.png'),
  attempt: 1
})

Vue.prototype.$http = http

//cookie
Vue.prototype.setCookie = function(name, value, day) {
  var date = new Date()
  date.setTime(date.getTime() + day*24*60*60*1000)
  document.cookie = name + "=" + escape(value) + ";expires=" + date.toGMTString()
}

Vue.prototype.getCookie = function(name){
  var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)")
  if (arr = document.cookie.match(reg)) {
    return arr
  } else {
    return null
  }
}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
